package br.com.furb.model;

import java.util.ArrayList;
import java.util.List;

import br.com.furb.model.enums.ConstraintType;

/**
 * Representa uma constraint da tabela.
 *  
 * @since 01/11/2011
 */
public class Constraint {
	
	private Long code;
	private String name;
	private ConstraintType constraintType;
	private List<Column> columns;
	private Table referencedTable;
	private List<Column> referencedColumns;

	/**
	 * 
	 */
	public Constraint(){
		this(0l,"",null,new ArrayList<Column>(),null,new ArrayList<Column>());
	}
	
	/**
	 * @param code - o codigo
	 * @param name - o nome
	 * @param constraintType - o tipo da constraint
	 * @param columns - as colunas referenciadas
	 * @param referencedTable - a tabela referenciada
	 * @param referencedColumns - as colunas referenciadas da tabela referenciada
	 */
	public Constraint(Long code, String name, ConstraintType constraintType, List<Column> columns, Table referencedTable, List<Column> referencedColumns) {
		this.code = code;
		this.name = name;
		this.constraintType = constraintType;
		this.columns = columns;
		this.referencedTable = referencedTable;
		this.referencedColumns = referencedColumns;
	}

	/**
	 * @return code - o codigo
	 */
	public Long getCode() {
		return code;
	}
	
	/**
	 * @param code - o codigo
	 */
	public void setCode(Long code) {
		this.code = code;
	}
	
	/**
	 * @return name - o nome
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * @param name - o nome
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * @return constraintType - o tipo da constraint
	 */
	public ConstraintType getConstraintType() {
		return constraintType;
	}
	
	/**
	 * @param constraintType - o tipo da constraint
	 */
	public void setConstraintType(ConstraintType constraintType) {
		this.constraintType = constraintType;
	}
	
	/**
	 * @return columns - as colunas referenciadas
	 */
	public List<Column> getColumns() {
		return columns;
	}
	
	/**
	 * @param columns - as colunas referenciadas
	 */
	public void setColumns(List<Column> columns) {
		this.columns = columns;
	}
	
	/**
	 * @return referencedTable - a tabela referenciada
	 */
	public Table getReferencedTable() {
		return referencedTable;
	}
	
	/**
	 * @param referencedTable - a tabela referenciada
	 */
	public void setReferencedTable(Table referencedTable) {
		this.referencedTable = referencedTable;
	}
	
	/**
	 * @return referencedColumns - as colunas referenciadas da tabela referenciada
	 */
	public List<Column> getReferencedColumns() {
		return referencedColumns;
	}

	/**
	 * @param referencedColumns - as colunas referenciadas da tabela referenciada
	 */
	public void setReferencedColumns(List<Column> referencedColumns) {
		this.referencedColumns = referencedColumns;
	}
	
}